home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Conversion / Convert_PICT / Convert PICT.app / UncommentedPSCode / RoundRectangles < prev    next >
Text File  |  1994-05-24  |  3KB  |  160 lines

  1. %BEGIN ReoundRectangles
  2. /ovWidth 0 def
  3. /ovHeight 0 def
  4. /ovSize
  5. {
  6.     /ovHeight exch def
  7.     /ovWidth exch def
  8. }
  9. def
  10. /buildRRpath
  11. {
  12.     /rightCoord exch def
  13.     /bottomCoord exch def
  14.     /leftCoord exch def
  15.     /topCoord exch def
  16.     /startmatrix  matrix currentmatrix def
  17.     ovHeight 0 le
  18.     { /halfheight .0001 def }
  19.     {
  20.         ovHeight bottomCoord topCoord sub gt
  21.             {/halfheight bottomCoord topCoord sub 2 div def}
  22.             {/halfheight ovHeight 2 div def}
  23.         ifelse
  24.     }
  25.     ifelse
  26.     ovWidth 0 le
  27.     { /halfwidth .0001 def }
  28.     {
  29.         ovWidth rightCoord leftCoord sub gt
  30.             {/halfwidth rightCoord leftCoord sub 2 div def}
  31.             {/halfwidth ovWidth 2 div def}
  32.         ifelse
  33.     }
  34.     ifelse
  35.     halfwidth halfheight gt
  36.     {
  37.         /unscale halfwidth halfheight div def
  38.         1 halfheight halfwidth div  scale
  39.         /radius halfwidth def
  40.         /newleft leftCoord def
  41.         /newright rightCoord def
  42.         /newtop topCoord unscale mul def
  43.         /newbottom bottomCoord unscale mul def
  44.     }
  45.     {
  46.         /unscale halfheight halfwidth div def
  47.         halfwidth halfheight div 1 scale
  48.         /radius halfheight def
  49.         /newleft leftCoord unscale mul  def
  50.         /newright rightCoord unscale mul def
  51.         /newtop topCoord def
  52.         /newbottom bottomCoord def
  53.     }
  54.     ifelse
  55.     newleft halfwidth add newtop moveto
  56.     newright newtop newright newbottom radius arct
  57.     newright newbottom newleft newbottom radius arct
  58.     newleft newbottom newleft newtop radius arct
  59.     newleft newtop newright newtop radius arct
  60.     closepath
  61.     startmatrix setmatrix
  62. }
  63. def
  64. /roundrectpath
  65. {
  66.     /lastright exch  def
  67.     /lastbottom exch  def
  68.     /lastleft exch def
  69.     /lasttop exch def
  70.     newpath
  71.     lasttop lastleft lastbottom lastright buildRRpath
  72. }
  73. def
  74. /frameRRect
  75. {
  76.     /lastright exch  def
  77.     /lastbottom exch  def
  78.     /lastleft exch def
  79.     /lasttop exch def
  80.     penWidth 0 gt
  81.     penHeight 0 gt
  82.     and
  83.     {
  84.         gsave
  85.             penPattern usePattern
  86.             newpath
  87.             penWidth 1 eq
  88.             penHeight 1 eq
  89.             and
  90.             {
  91.                 lasttop lastleft lastbottom 1 sub  lastright 1 sub  buildRRpath
  92.                 stroke
  93.             }
  94.             {
  95.                 lasttop lastleft lastbottom lastright  buildRRpath
  96.                 save
  97.                     /ovHeight ovHeight penHeight 2 mul sub def
  98.                     /ovWidth ovWidth penWidth 2 mul sub def
  99.                     lasttop penHeight add
  100.                     lastleft penWidth add
  101.                     lastbottom penHeight sub 
  102.                     lastright penWidth sub
  103.                     buildRRpath
  104.                     eofill
  105.                 restore
  106.             }
  107.             ifelse
  108.         grestore
  109.     }
  110.     if
  111. } def
  112. /paintRRect
  113. {
  114.     gsave
  115.         penPattern usePattern
  116.         roundrectpath
  117.         fill
  118.     grestore
  119. }
  120. def
  121. /eraseRRect
  122. {
  123.     gsave
  124.         backPattern usePattern
  125.         roundrectpath
  126.         fill
  127.     grestore
  128. }
  129. def
  130. /invertRRect
  131. {
  132.     gsave
  133.         roundrectpath
  134.     grestore
  135. } def
  136. /fillRRect
  137. {
  138.     gsave
  139.         fillPattern usePattern
  140.         roundrectpath
  141.         fill
  142.     grestore
  143. } def
  144. /frameSameRRect
  145.     { lasttop lastleft lastbottom lastright frameRRect }
  146. def
  147. /paintSameRRect
  148.     { lasttop lastleft lastbottom lastright paintRRect }
  149. def
  150. /eraseSameRRect
  151.     { lasttop lastleft lastbottom lastright eraseRRect }
  152. def
  153. /invertSameRRect
  154.     { lasttop lastleft lastbottom lastright invertRRect }
  155. def
  156. /fillSameRRect
  157.     { lasttop lastleft lastbottom lastright fillRRect }
  158. def
  159. %END RoundRectangles
  160.